define(function(require, exports, module) {
	var $ = require("jQuery");
	var Handlebars = require("handlebars");
	var underscore=require("../common/underscore/underscore");
	//js没有作为模块输出，所以不能用别名
	require('../common/datatables.fixedcolumns/datatables.fixedcolumns');
	require("../common/ellipsis/ellipsis");
	var ajax = require("../common/util/ajax");
	require('../common/util/ajaxExt');
	require("./home.css");
	var home_tpl = require("./home.tpl");
	var template = Handlebars.compile(home_tpl);
	require("../common/common_require");

	var home = {
		fixedTableColumn : function(tableObj, leftColumns, rightColumns) {
			var table = tableObj.dataTable({
				"ordering" : false,
				"searching" : false,
				"info" : false,
				"paging" : false,
				"scrollCollapse" : true,
				"scrollX" : true,
				"bAutoWidth" : true
			});

			new $.fn.dataTable.FixedColumns(table, {
				leftColumns : leftColumns,
				rightColumns : rightColumns
			});
		},
		getMyTaskCount : function() {
			ajax({
				url : "/qaplus/task/select_my_task.json",
				success : function(result) {
					console.log(result);
				}
			});
		},
		getRecommendFileCount : function() {
			ajax({
				url : "/qaplus/recommend/count_recommend_file.json",
				success : function(result) {
					console.log(result);
				}
			});
		},
		getMyQuestionCount : function() {
			ajax({
				url : "/qaplus/q/count_all_my_q.json",
				success : function(result) {
					console.log(result);
				}
			});
		},
		getMyHomework : function() {
			ajax({
				url : "/qaplus/homework/count_my_homework.json",
				success : function(result) {
					console.log(result);
				}
			});
		},	
		queryHomeResources : function() {
			ajax({
				url : "/qaplus/resource/query_home_resource.json",
				success : function(result) {
					var html = template(result);
					$(".nav_container").html(html);
				}
			});
		}

	}

	// 输出接口，让boot.js启动
	module.exports = {
		init : function() {
			home.getMyTaskCount();
			home.getMyQuestionCount();
			home.queryHomeResources();
			home.getMyHomework();
			home.getRecommendFileCount();
		}
	};
});